package com.white.controller;

import com.white.bean.CommentView;
import com.white.mapper.CommentViewMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CommentViewController {
    @Autowired
    CommentViewMapper commentViewMapper;

    @GetMapping("/getCommentViewById/{userId}")
    @ResponseBody
    public List<CommentView> getCommentViewById(@PathVariable("userId") Long userId) {
        return commentViewMapper.getCommentViewById(userId);
    }

    @GetMapping("/getCommentView")
    @ResponseBody
    public List<CommentView> getCommentView(@CookieValue(UserController.LOGIN_USER_ID) Long userId) {
        return commentViewMapper.getCommentViewById(userId);
    }


}
